home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
edit
/
pcfolded.zip
/
FOLDED.DOC
next >
Wrap
Text File
|
1989-05-30
|
39KB
|
724 lines
FOLDED
A folding editor
(c) 1989
By Todd Burkey
1.0 GENERAL:
FOLDED is a dual mode editor that provides several advanced features
not currently found in text and programming editors. FOLDED is primarily
intended to be used as a source code editor. As such, it incorporates
a folding feature similar to that found in thought processor programs
but with added support for the C language (and eventually Pascal). FOLDED
also has some relational capabilities. These allow the user to associate
lines in their source files with sections of their documentation files
and vice-versa. And both folding and relations are incorporated in such a
fashion that they don't impact the original text files in any way.
2.0 FEATURES:
FOLDED also has the standard set of editor features, with a few bells and
whistles thrown in. It has dynamic 'as-you-type' searching, substitution by
block/global/direction of a string or exact word match (i.e. change
variable i to i_var throughout your code), block copy/move/kill in normal
or rectangular region modes, marks that allow intra-buffer movement, easy
movement between buffers, a trash can, variable skipping (point to a
variable, press ^n to skip to the next occurrence of it, ^p for previous),
configuration save (you can leave a multi-buffer edit session and come
back to the exact place you left off with all buffer positions restored),
built in help, prompting for the beginning user, one-key buffer cloning,
and more.
3.0 LIMITATIONS:
So what doesn't FOLDED do? Well, the first release will not have an UNDO
feature. The trash can will have to do. It also is dual mode, something
which may alienate some of the Emacs users out there (I am bi-editable,
since I use Emacs on some systems, graphic shell editors on others, vi
on still others). With a little work, the editor could actually be made
to work either as a dual mode editor or a single mode editor (hint to
hackers out there). It also could use some better screen optimization,
since I tended to develop it on high speed displays. It is usable at
2400 baud, but any slower than that and you are better off with ed.
The first release also won't have any key binding capability. I still
haven't decided upon the best approach to handle user-defined key maps.
Finally, FOLDED isn't a layered editor. My goals during the development
of FOLDED were to keep it relatively small (it is about 70K executable,
<6000 lines of source) and fast, so layering as implemented in emacs-like
editors was out.
4.0 HISTORY:
I wrote FOLDED simply to learn. Early on, I made a choice to 1) put
basic 'must-have' functionality in the editor, 2) put advanced concepts
into the editor that can't be handled by external programs (folding and
relational features), 3) implement a simple to use and understand multi
file editing capability so that moving between files and scratchpads
was easy, 4) design the editor so that I could add enhanced 'wish-list'
functionality as I determined I needed it, 5) ensure that the final
version of the editor would function the same on my Atari ST at home as
it does on the Sun or Apollo workstations and even as it does on the
mainframes, and 6) keep the program small (I hate long loading times).
The latter requirement somewhat dictates the earlier ones...at least
for the first release.
Having used many editors over the last 15 years, I decided to implement
(or try to anyway) the features I liked most in the various editors. This
decision steered me away from any thoughts of modifying an existing editor
like emacs or vi, hence I diverged from the 'standard' a bit. First, FOLDED
is an unconstrained editor. You can move your cursor anywhere on the screen
and when you enter insert mode (or copy a rectangular block of text) FOLDED
will take care of sticking in needed spaces. Another difference is that the
editor does not 'wrap' lines. Instead, you can scroll/page the entire window
sideways when necessary (the editor will do this for you if you are typing
past the end of the right margin). I got too used to this feature on the
Apollos, I guess. Also, FOLDED does not retain tab characters. Rather, they
are replaced with white space on input and FOLDED will optionally 'optimize'
your file when you write it out (i.e. inserting tabs wherever it can, removing
trailing spaces on lines, etc). Actually, FOLDED doesn't even retain leading
spaces in the way you might expect an editor to store them. All leading spaces
in a line are compressed to an integer variable upon file read-in. The user
still sees the spaces on the screen, but internally this sped up my folding
logic (at the cost of almost going insane over the added code complexity...
there is always a tradeoff).
5.0 COMPATIBILITY:
The first release of FOLDED has been tested on BSD4.2/3 (Suns, Symetric,
and Apollo), SYSVR3 (ETA-10...haha), the IBM PC, and the ATARI ST. It is
being ported by others to the Mac. A preliminary port of the code to the
BELLCORE MGR (window manager) environment took only two hours on a Sun
workstation and provided individual windows for each buffer (with
title bars).
6.0 EDITING COMMANDS:
When you invoke FOLDED the first time, press the ? key to see a cheat sheet
that tells you what each key does. The following section covers the FOLDED
commands in more detail. Note that whenever you are prompted for something
in FOLDED, you will see the default response inside of brackets. Pressing
the Return key will select this response. Also, in most cases, pressing
the ESC key will return you to the top level command mode of FOLDED. It is
important to remember that FOLDED is a DUAL mode editor. You start out in
command mode and must use one of the insert commands to actually add text
to the file you are editing. While in insert mode, you will continually be
informed of this fact by a status line on the bottom of the screen.
6.1 REPETITION:
Sometimes, you will wish to execute a command more than once. To do so,
press the number keys to indicate the number of times you wish to do
something and then do it. For example, if you wish to move down 4 pages,
press 4J or if you wish to delete 8 characters, press 8d. Currently,
only the movement and character delete commands utilize the feature.
6.2 MOVEMENT:
The standard 'rogue' keys are used for single character cursor movement :-).
Thus, the 'k' key will move you up one character, the 'j' key will move
you down one character, the 'h' key moves you left one character, and the
'l' key moves you right one character. As a natural extension of this, I
chose to have the 'K', 'J', 'H', and 'L' keys move you farther in the same
directions. For example, 'K' and 'J' will page you up and down, while the
'H' and 'L' keys will move you 20 characters to the left or right. If you
are using an ATARI ST, then the arrow keys also function for cursor movement.
You can also go to the beginning of a line by pressing the '^' key and
go to the end of a line by pressing the '$' key. To go to a specific
line number, just press the 'g' key and you will be prompted for the
line number you wish to go to. For those of you who prefer the jump-page
technique over scrolling, you can toggle between the two modes by pressing
the 'p' key.
6.3 READING:
FOLDED allows you to read files in a variety of ways. The standard way is to
simply invoke FOLDED with a list of files to edit. When you are in FOLDED,
you can read a file into a new buffer by using the ':r' keys. If you wish
to view a file (i.e. not be able to edit it), then use the ':v' keys. And,
if you wish to insert a file into the current buffer, then use the ':i' keys.
In each case, you will be prompted for the file name you wish to read in.
Another way of reading files is to simply position the cursor over a file
name and press '^r' (Control-r). Likewise, you can press '^v